package org.star.service;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.star.entity.model.CouponDO9000;
import org.star.mapper.CouponMapper9000;

import javax.annotation.Resource;

/**
 * @Author : 一叶浮萍归大海
 * @Date: 2024/6/11 16:46
 * @Description:
 */
@Service
public class CouponServiceImpl9000 extends ServiceImpl<CouponMapper9000, CouponDO9000> implements CouponService9000 {

    @Resource
    private CouponMapper9000 couponMapper;

    public String getCouponById(Integer id) {
        CouponDO9000 dbCouponDO = couponMapper.selectById(id);
        if (ObjectUtil.isNotNull(dbCouponDO)) {
            return JSON.toJSONString(dbCouponDO);
        }

        return "未查询到id为【" + id + "】的优惠券!";
    }

}
